<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<jsp:directive.page contentType="text/html" pageEncoding="UTF-8" />
<html xmlns:jsp="http://java.sun.com/JSP/Page" >
<head>
<title>Online library - book details</title>
</head>

<spring:url value="/rest_book/${book.title}" var="rest_url"/>

<body>
 <div id="centered">
	<jsp:include page="header.jsp" />
	<h2>You choose a book: ${book.title}</h2>
	<br />

	<a href="${rest_url}"> Get rest book </a>

	<table id="box-table-a">
		<tr>
			<td>Author :</td>
			<td> ${book.author}</td>
		</tr>
		<tr>
			<td>Genre :</td>
			<td><c:forEach var="genre" items="${book.genre}">
					<p>${genre}
				</c:forEach></td>
		</tr>
		<tr>
			<td>Publication Date :</td>
			<td>${book.pubDate}</td>
		</tr>
		<tr>
			<td>Pages :</td>
			<td>${book.pages}</td>
		</tr>
		<tr>
			<td>ISBN :</td>
			<td>${book.isbn}</td>
		</tr>
	</table>
	<br/>
	<c:choose>
	<c:when test="${curUser ne null}">
					
					<spring:url value="/add_to_user/${book.title}" var="add_to_user"/>
					<a href="${add_to_user}">Add to personal collection</a>										
				</c:when>
</c:choose>
</div>
</body>
</html>